<?php
/**
 * 系统模型控制器
 * @author maniac
 */
namespace app\manage\controller;

use app\common\model\Fields;

class Mods extends Base
{
    /**
     * 首页补充
     * @param  array $data 列表信息
     */
    public function indexAttach($data)
    {
        $this->getVars();
    }
    
    /**
     * 添加/编辑补充
     * @param  array $data 列表信息
     */
    public function addAttach($data)
    {
        $this->getVars();
        $where[] = [
            ['tbname', 'in', 'contents,'.input('tbname/s', '')],
        ];
        $fields  = Fields::field('id,f,fname,list_order')->where($where)->order('list_order DESC, id ASC')->select();
        $this->assign('fields', $fields);
    }
    
    /**
     * where 查询条件
     */
    public function where()
    {
        $tid   = input('tid/d', 0);
        $where = [
            'tid' => $tid,
        ];
        return $where;
    }
    
    /**
     * 获取输入变量
     */
    private function getVars()
    {
        $tid    = input('tid/d', 0);
        $tbname = input('tbname/s', '');
        $this->assign('tid', $tid);
        $this->assign('tbname', $tbname);
    }
}
